package kr.hkit.powerjava.chapter12;

public class Rectangle extends Shape{
	private int width;
	private int height;
	
	
	@Override
	public void draw() { //draw메소드 오버라이딩. 꼭 구현하거나. 강제한다
		System.out.println("사각형을 그림.");
	}
	
	
	public static void main(String[] args) {
		Shape[] arrShape = new Shape[2];
		arrShape[0] = new Rectangle();
		arrShape[1] = new Triangle();
		
		for(Shape sh:arrShape) { //확장된 for loop
			sh.draw();
		}
	}
}

 class Triangle extends Shape { //아님 추상클래스로 하거나

	@Override
	public void draw() {
		System.out.println("삼각형을 그림");		
	} 
	
}